<template>
  <div>
    <div id="main" style="width: 500px;height: 500px"></div>

  </div>

</template>

<script>
import * as echarts from 'echarts';
export default {
  name: "PieUser",
  mounted() {
    const chartDom = document.getElementById('main');
    const myChart = echarts.init(chartDom);
    let option;
    option = {
      title: {
        text: '用户年龄分布',
        subtext: 'Fake Data',
        left: 'center'
      },
      tooltip: {
        trigger: 'item'
      },
      legend: {
        orient: 'vertical',
        left: 'left'
      },
      series: [
        {
          name: 'Access From',
          type: 'pie',
          radius: '50%',
          data: [
            { value: 1048, name: '18-30岁' },
            { value: 735, name: '30-40岁' },
            { value: 580, name: '40-50岁' },
            { value: 484, name: '50-60岁' },
            { value: 300, name: '60-80岁' }
          ],
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(0, 0, 0, 0.5)'
            }
          }
        }
      ]
    };

    option && myChart.setOption(option);
  }
}


</script>

<style scoped>

</style>